﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<ImbaTracker.Models.User>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Users
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Users</h2>

    <table>
        <tr>
            <th> UserId </th>
            <th> Login </th>
            <th> Name </th>
            <th></th>
        </tr>

    <% foreach (var item in Model) { %>
        <tr>
            <td> <%: item.Id %> </td>
            <td> <%: item.Login %> </td>
            <td> <%: item.Name %> </td>
            <td>
                <% if (ImbaTracker.Content.Helper.canAccess(User, item.Id)) {%>
                <%:    Html.ActionLink("Edit", "Edit", new { id=item.Id }) %> |
                <%:    Html.ActionLink("Details", "Details", item)%> |
                <%      if (item.Login != "Administrator") { %>
                <%:         Html.ActionLink("Delete", "Delete", new { id = item.Id })%>
                <%      } %>
                <% } %>
            </td>
        </tr>
    
    <% } %>

    </table>

    <p>
        <%: Html.ActionLink("Create New", "Create") %>
    </p>

</asp:Content>

